import { queryMenuApi } from '@/api/sys/menuManage'
import modelExtend from '@/utils/dvaUtil/modelExtend'

export const namespace = 'menuManage'

const initialState = {
  entranceList: [],
}

export default modelExtend({
  namespace,
  state: initialState,
  matchedActions: toAction => {
    toAction('getTreeMenu')
  },
  effects: {
    *getTreeMenu(_, { call, update }) {
      const { data } = yield call(queryMenuApi)
      yield update({ entranceList: data })
    },
  },
})
